/**
 * Created by lemon on 2017/6/24.
 */

var webpack = require('webpack');

module.exports = {
    entry: {
        app: './src/app', //编译的入口文件
    },
    output: {
        publicPath: "build/",
        path:__dirname+'/build', //编译到当前目录
        filename: '[name].js' //编译后的文件名字
    },
    module: {
        loaders: [{
            test: /\.js$/,
            loader: 'babel-loader?presets=es2015'
        }, {
            test: /\.css$/,
            loaders: ['style-loader', 'css-loader', 'autoprefixer-loader']
        }, {
            test: /\.less/,
            loaders: ['style-loader', 'css-loader', 'autoprefixer-loader', 'less-loader'],
        }, {
            test: /\.(eot|woff|svg|ttf|woff2|gif)(\?|$)/,
            loader: 'file-loader?name=[hash].[ext]'
        }, {
            test: /\.(png|jpg)$/,
            loader: 'url-loader?limit=1200&name=[hash].[ext]' //注意后面那个limit的参数，当你图片大小小于这个限制的时候，会自动启用base64编码图片
        }, {
                test: /\.html$/,
                loader: 'raw-loader' //注意后面那个limit的参数，当你图片大小小于这个限制的时候，会自动启用base64编码图片
            }
        ]
    },
    plugins: [
        new webpack.optimize.CommonsChunkPlugin('common') //将公用模块，打包进common.js
    ]

};